home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / FADERS.ZIP / P_UNCRNH.INC < prev    next >
Encoding:
Text File  |  1995-08-23  |  2.9 KB  |  86 lines

  1. uncrunch proc
  2. ;
  3. ;Parameters Required:
  4. ;  DS:SI  Crunched image source pointer.
  5. ;  ES:DI  Display address pointer.
  6. ;  CX     Length of crunched image source data.
  7. ;
  8.        PUSH    SI                      ;Save registers.
  9.        PUSH    DI
  10.        PUSH    AX
  11.        PUSH    BX
  12.        PUSH    CX
  13.        PUSH    DX
  14.        JCXZ    Done
  15.  
  16.        MOV     DX,DI                   ;Save X coordinate for later.
  17.        XOR     AX,AX                   ;Set Current attributes.
  18.        CLD
  19.  
  20. LOOPA: LODSB                           ;Get next character.
  21.        CMP     AL,32                   ;If a control character, jump.
  22.        JC      ForeGround
  23.        STOSW                           ;Save letter on screen.
  24. Next:  LOOP    LOOPA
  25.        JMP     Short Done
  26.  
  27. ForeGround:
  28.        CMP     AL,16                   ;If less than 16, then change the
  29.        JNC     BackGround              ;foreground color.  Otherwise jump.
  30.        AND     AH,0F0H                 ;Strip off old foreground.
  31.        OR      AH,AL
  32.        JMP     Next
  33.  
  34. BackGround:
  35.        CMP     AL,24                   ;If less than 24, then change the
  36.        JZ      NextLine                ;background color.  If exactly 24,
  37.        JNC     FlashBitToggle          ;then jump down to next line.
  38.        SUB     AL,16                   ;Otherwise jump to multiple output
  39.        ADD     AL,AL                   ;routines.
  40.        ADD     AL,AL
  41.        ADD     AL,AL
  42.        ADD     AL,AL
  43.        AND     AH,8FH                  ;Strip off old background.
  44.        OR      AH,AL
  45.        JMP     Next
  46.  
  47. NextLine:
  48.        ADD     DX,160                  ;If equal to 24,
  49.        MOV     DI,DX                   ;then jump down to
  50.        JMP     Next                    ;the next line.
  51.  
  52. FlashBitToggle:
  53.        CMP     AL,27                   ;Does user want to toggle the blink
  54.        JC      MultiOutput             ;attribute?
  55.        JNZ     Next
  56.        XOR     AH,128                  ;Done.
  57.        JMP     Next
  58.  
  59. MultiOutput:
  60.        CMP     AL,25                   ;Set Z flag if multi-space output.
  61.        MOV     BX,CX                   ;Save main counter.
  62.        LODSB                           ;Get count of number of times
  63.        MOV     CL,AL                   ;to display character.
  64.        MOV     AL,32
  65.        JZ      StartOutput             ;Jump here if displaying spaces.
  66.        LODSB                           ;Otherwise get character to use.
  67.        DEC     BX                      ;Adjust main counter.
  68.  
  69. StartOutput:
  70.        XOR     CH,CH
  71.        INC     CX
  72.        REP STOSW
  73.        MOV     CX,BX
  74.        DEC     CX                      ;Adjust main counter.
  75.        LOOPNZ  LOOPA                   ;Loop if anything else to do...
  76.  
  77. Done:  POP     DX                      ;Restore registers.
  78.        POP     CX
  79.        POP     BX
  80.        POP     AX
  81.        POP     DI
  82.        POP     SI
  83.        RET
  84.  
  85. ENDP
  86.